package com.anke.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.anke.dao.CompanyDao;
import com.anke.entity.Company;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

@Service(interfaceClass = CompanyService.class)
@Transactional// 添加事务的支持
public class CompanyServiceImpl implements CompanyService{

    @Autowired
    private CompanyDao companyDao;

    @Override
    public void register(Company company) {
        companyDao.register(company);
    }

    @Override
    public boolean login(Company company) {
        List<Company> c = companyDao.selectCompanyByUsernameAndPassword(company);
        return !c.isEmpty();
    }

    @Override
    public List<Company> selectAllCompany() {
        return companyDao.selsctAllCompany();
    }

    @Override
    public List<Company> selectCompanyByType(Company company) {
        return companyDao.selectCompanyByType(company);
    }

    @Override
    public List<Company> selectCompanyByName(Company company) {
        return companyDao.selectCompanyByName(company);
    }

    @Override
    public List<Company> selectCompanyByLocation(Company company) {
        return companyDao.selectCompanyByLocation(company);
    }

    @Override
    public void deleteCompany(Company company) {
        companyDao.deleteCompany(company);
    }
    @Override
    public void updateCompany(Company company) {
        companyDao.updateCompany(company);
    }
}
